/*
 * @Author: swc shanwenchao12138@163.com
 * @Date: 2024-10-10 10:23:08
 * @LastEditors: swc
 * @LastEditTime: 2024-12-10 15:27:25
 * @FilePath: \xf\src\components\custom\homePage\homeCpt\o-message-list\config.ts
 * @Description:
 * @Version: 2.0
 * @Autor: swc
 */
import { T_srv, Tsrv, ifs, ts, tvs, vue } from '@/services';
import { I_cmd, T_cmd, Tcmd } from './command';
import { N_oMessageList } from './type';

const getMsgOptions = (): N_oMessageList.I_filterOption[] => [
  {
    label: '广播',
    value: tvs.V_msgType.BROADCAST,
    disabled: false,
    children: [
      // {
      //   label: '紧急广播',
      //   value: tvs.V_broadcastCategory.EMERGENCY,
      //   children: []
      // }
    ]
  },
  {
    label: '预警',
    value: tvs.V_msgType.EARLY_WARNING,
    disabled: false,
    children: []
    // {
    //   label: '紧急预警',
    //   value: tvs.V_earlyWarningCategory.EMERGENCY,
    //   children: []
    // }
  },
  {
    label: '警报',
    value: tvs.V_msgType.ALARM,
    disabled: false,
    children: []
    // {
    //   label: '安全警告',
    //   value: tvs.V_alarmCategory.SAFETY,
    //   children: []
    // }
  },
  {
    label: '通知',
    value: tvs.V_msgType.NOTICE,
    disabled: false,
    children: [
      // {
      //   label: '公告通知',
      //   value: tvs.V_noticeCategory.BULLETIN,
      //   children: []
      // }
    ]
  },
  {
    label: '待办事项',
    value: tvs.V_msgType.TO_DO_LIST,
    children: [
      // {
      //   label: '审批待办',
      //   value: tvs.V_todoListCategory.APPROVAL,
      //   children: []
      // }
    ]
  }
];

const getColumns = (): any[] => [
  {
    title: Tsrv.getI18nByValue('标题'),
    key: 'title',
    align: 'center',
    fixed: 'left',
    tooltipTheme: 'light',
    tooltip: true,
    ellipsis: true
  },
  {
    title: Tsrv.getI18nByValue('内容'),
    key: 'note',
    align: 'left',
    tooltipTheme: 'light',
    tooltip: true,
    ellipsis: true
  },
  {
    title: Tsrv.getI18nByValue('时间'),
    key: 'sendTime',
    align: 'center',
    tooltipTheme: 'light',
    tooltip: true,
    ellipsis: true,
    sortable: true
  },
  {
    title: Tsrv.getI18nByValue('发送人'),
    key: 'sender',
    // slot: 'sender',
    align: 'center',
    display: 'none',
    tooltipTheme: 'light',
    tooltip: true,
    ellipsis: true,
    sortable: true,
    render: (h, params) => {
      return h('div', [
        h('span', {
          // class: 'wy-icon wy-yonghu2'
          class: ['wy-icon', 'wy-yonghu2'],
          style: { marginRight: '5px' }
        }),
        h('span', params.row.sender)
      ]);
    }
  },
  {
    title: Tsrv.getI18nByValue('删除'),
    slot: 'action',
    tooltipTheme: 'light',
    tooltip: true,
    width: 70,
    align: 'center'
  }
];

export {
  I_cmd,
  T_cmd,
  T_srv,
  Tcmd,
  Tsrv,
  getColumns,
  getMsgOptions,
  ifs,
  ts,
  tvs,
  vue
};
